package com.duowei.diandan.bean.food;

import java.util.List;
import java.util.Objects;

/**
 * 单品组
 */
public class SingleGroup implements FoodImpl {
    /** 编号(Dpzsz bm + "_dpz") */
    private String no;
    /** 名称(Dpzsz nr) */
    private String name;

    private Float xl;

    /** Single 或 SingleAndMeals */
    private List<? extends FoodImpl> foodList;

    public SingleGroup(String no, String name, Float xl, List<? extends FoodImpl> foodList) {
        this.no = no;
        this.name = name;
        this.xl = xl;
        this.foodList = foodList;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    @Override
    public String getImgNo() {
        return no;
    }

    public String getName() {
        return name;
    }

    @Override
    public Float getPrice() {
        return null;
    }

    @Override
    public Float getMemberPrice() {
        return null;
    }

    @Override
    public Float getXl() {
        return this.xl;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<? extends FoodImpl> getFoodList() {
        return foodList;
    }

    public void setFoodList(List<Single> foodList) {
        this.foodList = foodList;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof SingleGroup) {
            SingleGroup ss = (SingleGroup) obj;

            return Objects.equals(this.no, ss.no)
                    && Objects.equals(this.name, ss.name)
                    && this.foodList.containsAll(ss.foodList)
                    && ss.foodList.containsAll(this.foodList);
        } else {
            return false;
        }
    }
}
